// @flow
import React from 'react'
import { Card, Col, Row, Icon, Input, InputNumber, Button, message, Select, Spin } from 'antd'
import LineDark from 'components/LineDark'
import ColumnDark from 'components/ColumnDark'
import LineDarkStock from 'components/LineDarkStock'
import GifInfo from 'components/GifInfo'
import universalFetch, { handleFetchError } from 'store/modules/fetch'
import styles from './DeviceCard.css'
import { saveGroupId, saveDeviceData } from 'store/modules/deviceCard'
import { connect } from 'react-redux'
import moment from 'moment'
import classnames from 'classnames/bind'
const cx = classnames.bind(styles)
import ReactDom from 'react-dom'
import R from 'ramda'
const Option = Select.Option

// const xData = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12']
// const chartData = [{
//   name: '制氧能耗',
//   type: 'line',
//   data: [17.0, 16.9, 19.5, 14.5, 11.2, 21.5, 21.2, 26.5, 13.3, 11.3, 13.9, 19.6]
// }]
type Props = {
  saveGroupId: Function,
  saveDeviceData: Function,
  location: Object,
  history: Object
}

type State = {
  cardData: Array<Object>,
  xData: Array<string>,
  deviceStatus: Array<Object>,
  chartData: Array<Object>,
  xData1: Array<string>,
  chartData1: Array<Object>,
  faultXData: Array<string>,
  faultChartData: Array<Object>,
  liquidO: any, // 输入的制氧量值
  resultLiquiO: any, // 计算出的制氧量结果
  FIC105: number,
  AIA104: number,
  FIQ1201: number,
  deviceLiguidO: Object,
  tcsO2Data: Array<Object>, // 左下角tcs氧的提取率折线图数据
  tcsO2Loading: boolean,
  lengent: Array<Object>,
  eventYear: string,
  susbYear: string,
  footVisible: boolean
}

class DeviceCard extends React.Component {
  props: Props
  state: State
  intervalO: number
  toFile: Function
  hideModal: Function
  showModal: Function
  goToCondition: Function
  liquidOChange: Function
  getO2Value: Function
  getKmxValue: Function
  updataPage: Function
  changeDeviceLiguidO: Function
  getO2Line: Function
  eventCount: Function
  changeEventYear: Function
  changeSusbYear: Function
  getSusb: Function
  constructor (props: Object) {
    super(props)
    this.state = {
      cardData:[],
      xData:[],
      deviceStatus: [],
      chartData:[],
      xData1: [],
      chartData1: [],
      faultXData: [],
      faultChartData: [],
      liquidO: '',
      resultLiquiO: '结果',
      FIC105: -100000000, // 表示未请求到数据
      AIA104: -100000000,
      FIQ1201: -100000000,
      deviceLiguidO: { FIC105: '', AIA104: '', FIQ1201: '' },
      tcsO2Data: [],
      tcsO2Loading: false,
      lengent: [],
      eventYear: '2017',
      susbYear: '2017',
      footVisible: true
    }
    this.toFile = this.toFile.bind(this)
    this.hideModal = this.hideModal.bind(this)
    this.showModal = this.showModal.bind(this)
    this.goToCondition = this.goToCondition.bind(this)
    this.liquidOChange = this.liquidOChange.bind(this)
    this.getO2Value = this.getO2Value.bind(this)
    this.getKmxValue = this.getKmxValue.bind(this)
    this.updataPage = this.updataPage.bind(this)
    this.changeDeviceLiguidO = this.changeDeviceLiguidO.bind(this)
    this.getO2Line = this.getO2Line.bind(this)
    this.eventCount = this.eventCount.bind(this)
    this.changeEventYear = this.changeEventYear.bind(this)
    this.changeSusbYear = this.changeSusbYear.bind(this)
    this.getSusb = this.getSusb.bind(this)
  }

  componentWillMount () {
    this.updataPage(this.props)
    // 在字典中取设备状态，判断设备机组中点点的颜色
    universalFetch(`${__SERVICE_API__}sys/dicts?type=deviceStatus`)
    .then((res) => res.json())
    .then((json) => {
      if (json.code !== 200000) {
        throw new Error(JSON.stringify({ code: json.code, message: json.message }))
      }
      this.setState({
        deviceStatus: json.result
      })
    })
    .catch((error) => {
      handleFetchError(error)
      console.error(error)
    })
  }

  componentWillReceiveProps (nextProps) {
    if (!R.equals(nextProps, this.props)) {
      this.updataPage(nextProps)
    }
  }

  componentWillUnmount () {
    clearInterval(this.intervalO)
  }
/*
左下角tcs氧的提取率计算
*/
  getO2Line () {
    const { location } = this.props
    const { data } = location.state
    this.setState({
      tcsO2Loading: true
    })
    // console.log(data);
    const postBody = JSON.stringify({
      fieldGroup: 'c_calculate',
      fields: ['extractionO'],
      coValueFilter: {
        idFieldFilter: {
          factory_id: { '$eq': String(data.customerNo) },
          // factory_id: { '$eq': '1' },
          equipment_id: { '$eq': '10000' },
          machine_id: { '$eq': '10000' },
          channel_type: { '$eq': '4' },
          datatype: { '$eq': '1' },
          '$or': [{ 'channel_id': { '$eq': '10000' } }]
        }
      },
      timeRange: {
        start:'now-7d',
        end: 'now'
      },
      valueFilters: [
          { '$default': { '$or': [{ '$gt': -1000000 }] } }
      ],
      size: 10000,
      page: 1
    })
    fetch(`${__KMX_API__}data-streams`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      body: postBody
    })
    .then((res) => res.json())
    .then((json) => {
      if (json.code !== 0) {
        throw new Error(JSON.stringify({ code: json.code, message: json.message }))
      }
      this.setState({
        tcsO2Loading: false,
        tcsO2Data: json.results.map((d, i) => {
          d['name'] = '氧的提取率'
          d['type'] = 'line'
          d['data'] = d.streams
          return d
        })
      })
    })
    .catch((error) => {
      console.error(error)
      this.setState({
        tcsO2Loading: false,
        tcsO2Data: []
      })
    })
  }

  updataPage (props) {
    const component = this
    const { location } = props
    const { data } = location.state
    // 机组信息
    universalFetch(`${__SERVICE_API__}device/customers/${location.state.groupId}/devices`)
      .then((res) => res.json())
      .then((json) => {
        if (json.code !== 200000) {
          throw new Error(JSON.stringify({ code: json.code, message: json.message }))
        }
        component.setState({
          cardData: json.result
        })
      })
      .catch((error) => {
        handleFetchError(error)
        console.error(error)
      })

      // 故障分布
    // const startTime = moment().subtract(3, 'months').toISOString()
    // const endTime = moment().toISOString()
    // universalFetch(`${__SERVICE_API__}device/events/faults/types/count` +
    //   `?customer_id=${location.state.groupId}` +
    //   `&start_date=${startTime}` +
    //   `&end_date=${endTime}`)
    // .then((res) => res.json())
    // .then((json) => {
    //   if (json.code !== 200000) {
    //     throw new Error(JSON.stringify({ code: json.code, message: json.message }))
    //   }
    //   component.setState({
    //     faultXData: json.result.map((d) => {
    //       return d.eventType
    //     }),
    //     faultChartData: [{
    //       name: '故障数',
    //       type: 'column',
    //       data: json.result.map((d) => {
    //         return d.count
    //       })
    //     }]
    //   })
    // })
    // .catch((error) => {
    //   handleFetchError(error)
    //   console.error(error)
    // })
    universalFetch(`${__SERVICE_API__}device/customers/faults?customerId=${location.state.groupId}`)
      .then((res) => res.json())
      .then((json) => {
        if (json.code !== 200000) {
          throw new Error(JSON.stringify({ code: json.code, message: json.message }))
        }
        const res = json.result
        if (res.length > 0) {
          const faultXData = Object.keys(res[0].faults)
          component.setState({
            faultXData: faultXData,
            faultChartData: [{
              name: '故障数',
              type: 'column',
              data: faultXData.map((d) => {
                return res[0].faults[d]
              })
            }]
          })
        }
      })
      .catch((error) => {
        handleFetchError(error)
        console.error(error)
      })
    // 如果是tcs客户，左下角查询氧的提取率
    if (data.dataSources) {
      if (data.dataSources.indexOf('TCS') > -1) {
        this.getO2Line()
      } else {
        this.eventCount(props)
      }
    } else {
      this.eventCount(props)
    }
    // 开机时长 （不传参数是当年的： 2017）
    this.getSusb(props)
  }

  getSusb (props) {
    const component = this
    const { location } = props
    const { susbYear } = this.state
    // 开机时长 （不传参数是当年的： 2017）
    universalFetch(`${__SERVICE_API__}device/customers/${location.state.groupId}/susb?years=${susbYear}`)
      .then((res) => res.json())
      .then((json) => {
        if (json.code !== 200000) {
          throw new Error(JSON.stringify({ code: json.code, message: json.message }))
        }
        const result = json.result
        // const years = result['2017']
        const years = result[susbYear]
        if (years) {
          const xData1 = Object.keys(years)
          let chartD = []
          years[xData1[0]]['devices'].map((d, i) => {
            chartD.push({
              name: d.deviceName,
              type: 'column',
              data: xData1.map((dd, ii) => {
                const count = Number(years[dd]['devices'][i]['days'])
                if (count === 0) {
                  return null
                } else {
                  return count
                }
              })
            })
          })
          // const data = xData1.map((d, i) => {
          //   return Number(years[d]['days'])
          // })
          component.setState({
            xData1: xData1.map((d, i) => {
              return d + '月'
            }),
            chartData1: chartD
            // chartData1: [{
            //   name: '开机时长',
            //   type: 'column',
            //   data: data
            // }]
          })
        } else {
          component.setState({
            xData1: [],
            chartData1: []
          })
        }
      })
      .catch((error) => {
        handleFetchError(error)
        console.error(error)
      })
  }

  changeEventYear (value) {
    this.setState({
      eventYear: value
    }, () => {
      this.eventCount(this.props)
    })
  }

  changeSusbYear (value) {
    this.setState({
      susbYear: value
    }, () => {
      this.getSusb(this.props)
    })
  }

  eventCount (props) {
    const component = this
    const { eventYear } = this.state
    const { location } = props
    // const { data } = location.state
    // 事件统计 28 先从字典中查询记录类型
    universalFetch(`${__SERVICE_API__}sys/dicts?type=eventType`)
      .then((res) => res.json())
      .then((json) => {
        if (json.code !== 200000) {
          throw new Error(JSON.stringify({ code: json.code, message: json.message }))
        }
        const colors = ['#2b908f', '#90ee7e', '#f45b5b', '#7798BF', '#eeaaee', '#aaeeee', '#ff0066', '#eeaaee',
          '#55BF3B', '#DF5353', '#7798BF', '#aaeeee'
        ]
        const eventType = json.result.map((d, i) => {
          const len = i % colors.length
          d['color'] = colors[len]
          return d
        })
        // 事件统计
        universalFetch(`${__SERVICE_API__}device/customers/${location.state.groupId}/eventcount?year=${eventYear}`)
          .then((res) => res.json())
          .then((json) => {
            if (json.code !== 200000) {
              throw new Error(JSON.stringify({ code: json.code, message: json.message }))
            }
            const result = json.result
            let types = []
            const data = result.data.map((d, i) => {
              const thisType = eventType.filter((dd) => dd.value === d.type)
              if (types.indexOf(d.type) === -1) {
                types.push(d.type)
              }
              return {
                name: thisType.length > 0 ? thisType[0].label : d.type,
                type: 'column',
                color: thisType.length > 0 ? thisType[0].color : '#2b908f',
                data: d.count,
                stack: d.deviceName
              }
            })
            let lengent = []
            eventType.map((d, i) => {
              if (types.indexOf(d.value) > -1) {
                lengent.push(d)
              }
            })
            component.setState({
              lengent: lengent,
              xData: result.month.map((d, i) => {
                return d + '月'
              }),
              chartData: data
            })
          })
          .catch((error) => {
            handleFetchError(error)
            console.error(error)
          })
      })
      .catch((error) => {
        handleFetchError(error)
        console.error(error)
      })
  }

  goToCondition (item) {
    const { saveGroupId, saveDeviceData, location, history } = this.props
    const groupId = location.state.groupId
    saveGroupId(groupId)
    saveDeviceData(item.data)
    const loc = {
      pathname: `/device-file/${item.data.id}/condition`,
      state: {
        defaultActiveKey: 'dynamicTab',
        dynamicIndicator: item.mes.fieldgroupId + '___' + item.mes.variable,
        defaultChannel: [item.mes.channelId + '__' + item.mes.name]
      }
    }
    history.push(loc)
  }

  toFile (data) {
    const { saveGroupId, saveDeviceData, location, history } = this.props
    const groupId = location.state.groupId
    saveGroupId(groupId)
    saveDeviceData(data)
    history.push(`/device-file/${data.id}/overview`)
  }

  showModal (data) {
    const container = this.refs.GifInfoCon
    ReactDom.render(
      <GifInfo {...{
        data,
        cardData: this.state.cardData,
        goToCondition: this.goToCondition,
        removeGifInfoModal: this.hideModal
      }} />,
      container
    )
  }

  hideModal () {
    const container = this.refs.GifInfoCon
    ReactDom.unmountComponentAtNode(container)
  }

  liquidOChange (value) {
    if (!isNaN(value)) {
      this.setState({
        liquidO: value
      })
    }
  }

  getO2Value () {
    const component = this
    const { liquidO } = this.state
    if (liquidO === '') {
      message.info('请输入制氧量')
      this.setState({
        resultLiquiO:'结果'
      })
      clearInterval(this.intervalO)
      return false
    }
    this.getKmxValue()
    clearInterval(this.intervalO)
    this.intervalO = setInterval(function () {
      component.getKmxValue()
    }, 600000) // 10min更新一次
  }

  getKmxValue () {
    const component = this
    const { liquidO, deviceLiguidO } = this.state
    if (deviceLiguidO.FIC105 === '') {
      message.info('请选择出冷箱氧气产量的设备')
      return
    }
    if (deviceLiguidO.AIA104 === '') {
      message.info('请选择氧气纯度的设备')
      return
    }
    if (deviceLiguidO.FIQ1201 === '') {
      message.info('请选择分子筛选后空气总量的设备')
      return
    }
    // 从KMX中取出FIC105/AIA104/FIQ1201这三个值(TCS有数据后实现)
    const OArr = Object.keys(deviceLiguidO)
    OArr.map((item, index) => {
      const deviceNo = deviceLiguidO[item].split('_')
      // const postBody = JSON.stringify({
      //   fieldGroup: 'tcs_' + String(deviceNo[0]),
      //   fields: [item],
      //   coValueFilter: {
      //     idFieldFilter: {
      //       factory_id: { '$eq': String(deviceNo[0]) },
      //       equipment_id: { '$eq': String(deviceNo[1]) },
      //       machine_id: { '$eq': String(deviceNo[2]) },
      //       // channel_type: { '$eq': '0' },
      //       datatype: { '$eq': '1' },
      //       '$or': [{ 'channel_id': { '$eq': '0' } }]
      //     }
      //   },
      //   timeRange: {
      //     start:'now-10m',
      //     end: 'now'
      //   },
      //   order: [{ '$default': 'desc' }],
      //   size: 1,
      //   page: 1
      // })
      const postData = {
        'tsTable' : 'tcs_' + String(deviceNo[0]),
        // 'allCol' : 'true',
        'startTime' : moment().subtract(10, 'm').unix(),
        'endTime' : moment().unix(),
        'queryConditions' : [
          {
            'colName' : 'factory_id',
            'condition' : 'eq',
            'value' : String(deviceNo[0])
          },
          {
            'colName' : 'equipment_id',
            'condition' : 'eq',
            'value' : String(deviceNo[1])
          },
          {
            'colName' : 'machine_id',
            'condition' : 'eq',
            'value' : String(deviceNo[2])
          },
          {
            'colName' : 'datatype',
            'condition' : 'eq',
            'value' : 0
          },
          {
            'colName' : 'channel_id',
            'condition' : 'eq',
            'value' : 0
          }
        ],
        cols : [item]
      }
      const postBody = JSON.stringify(postData)
      const token = localStorage.getItem('asset_token')
      fetch(`${__SERVICE_API__}device/kmx/tsdb/query`, {
        method: 'POST',
        headers: {
          'Content-Type': 'application/json',
          'X-Auth': token
        },
        body: postBody
      })
      .then((res) => res.json())
      .then((json) => {
        if (json.code !== 0) {
          throw new Error(JSON.stringify({ code: json.code, message: json.message }))
        }
        const results = json.results
        if (results && results.length > 0) {
          const streams = results[0].streams
          if (streams && streams.length > 0) {
            this.setState({
              [item]: streams[0][1]
            })
          } else {
            this.setState({
              [item]: -100000000
            })
          }
        }
      })
      .catch((error) => {
        console.error(error)
        this.setState({
          [item]: -100000000
        })
      })
    })
    setTimeout(function () {
      const { FIC105, AIA104, FIQ1201 } = component.state
      // const FIC = Math.random()
      // const AIA = Math.random()
      // const FIQ = Math.random() // 是被除数，不能为0
      const FIC = FIC105
      const AIA = AIA104
      const FIQ = FIQ1201
      if (FIC === -100000000) {
        message.error('出冷箱氧气产量暂无数据')
        return
      }
      if (AIA === -100000000) {
        message.error('氧气纯度暂无数据')
        return
      }
      if (FIQ === -100000000) {
        message.error('分子筛选后空气总量暂无数据')
        return
      }
      if (FIQ === 0) {
        message.error('分子筛选后空气总量的值不能为0')
        return
      }
      component.setState({
        resultLiquiO:Number(((FIC + 700 * liquidO) * AIA) / FIQ * 0.209).toFixed(4)
      })
    }, 1000) // 1s后3个指标已请求完成？
  }

  changeDeviceLiguidO (item, value) {
    const { deviceLiguidO } = this.state
    this.setState({
      deviceLiguidO: Object.assign({}, deviceLiguidO, { [item] : value })
    })
  }

  hideFoot = () => {
    this.setState({
      footVisible: false
    })
  }
  showFoot = () => {
    this.setState({
      footVisible: true
    })
  }

  render () {
    const component = this
    const { cardData, deviceStatus, faultXData, faultChartData, liquidO, resultLiquiO, xData1, chartData1, lengent, footVisible } = this.state
    const { location } = this.props
    const { data } = location.state
    let city = data.region.city
    if (city === '市辖区') {
      city = ''
    }
    // dataSources数组中包含TCS就显示制氧量
    let showTcs = false
    if (data.dataSources) {
      if (data.dataSources.indexOf('TCS') > -1) {
        showTcs = true
      }
    }
    // 底部缩放
    const footIconStyle = cx({
      'footCon-icon': true,
      'down': footVisible,
      'up': !footVisible
    })
    const footConStyle = cx({
      'foot': true,
      'footCon-show': footVisible,
      'footCon-hidden': !footVisible
    })
    const leftConStyle = cx({
      'left': true,
      'left-show': !footVisible,
      'left-hidden': footVisible
    })
    const rightConStyle = cx({
      'right': true,
      'right-show': !footVisible,
      'right-hidden': footVisible
    })
    return (
      <div className={styles['main']}>
        <div className={leftConStyle}>
          <h3>客户信息</h3>
          <div className={styles['leftTop']}>
            <img src={data.imageUrl ? data.imageUrl : '/noimg.jpg'} />
          </div>
          <div className={styles['leftBottom']}>
            <ul>
              <li><span>客户名称</span>{data.name}</li>
              <li><span>客户类型</span>{data.type}</li>
              <li><span>客户地址</span>
                {data.region.province}{city}{data.region.district}
              </li>
              <li><span>设备数量</span>{data.count}</li>
              <li><span>在线数量</span>{data.onlineCount}</li>
              <li><span>投运日期</span>2015-01-01</li>
            </ul>
          </div>
        </div>
        <div className={rightConStyle}>
          <p className={styles['rightTit']}>机组信息
          </p>
          <div className={styles['rightCon']}>
            <div style={{ display: showTcs ? 'block' : 'none' }} className={styles['rightZhi']}>
              出冷箱氧气产量:
              <Select
                placeholder='请选择机组'
                onChange={function (value) { component.changeDeviceLiguidO('FIC105', value) }}
                style={{ width: 120, marginRight: 10 }}>
                {
                  cardData.map((d, i) => {
                    return <Option key={d.deviceNo}>{d.name}</Option>
                  })
                }
              </Select>
              氧气纯度:
              <Select
                placeholder='请选择机组'
                onChange={function (value) { component.changeDeviceLiguidO('AIA104', value) }}
                style={{ width: 120, marginRight: 10 }}>
                {
                  cardData.map((d, i) => {
                    return <Option key={d.deviceNo}>{d.name}</Option>
                  })
                }
              </Select>
              分子筛选后空气总量:
              <Select
                placeholder='请选择机组'
                onChange={function (value) { component.changeDeviceLiguidO('FIQ1201', value) }}
                style={{ width: 120, marginRight: 10 }}>
                {
                  cardData.map((d, i) => {
                    return <Option key={d.deviceNo}>{d.name}</Option>
                  })
                }
              </Select>
              <p style={{ paddingTop: 5, display:'inline-block' }}>
                <InputNumber value={liquidO} style={{ width:120 }} placeholder='输入制氧量' onChange={this.liquidOChange} />
                <Button
                  type='primary'
                  onClick={this.getO2Value}
                  style={{ marginRight:8 }}
                  >
                  计算
                </Button>
                <Input value={resultLiquiO} style={{ width: 100 }} />
              </p>
            </div>
            {
              cardData.map((data, i) => {
                let status = data.status
                let color = '#000'
                let deviceS = deviceStatus.filter((dd) => dd.value === status)
                if (deviceS.length > 0) {
                  color = deviceS[0].color
                }
                return <Card key={i}>
                  <Icon className={styles['carbg']} type='caret-left' />
                  {
                    // <a className={styles['carda']}>
                    // </a>
                  }
                  <h3 title={data.name} onClick={() => this.toFile(data)} style={{ cursor:'pointer' }}>
                    <span className={styles['redSpot']} style={{ color: color }}>●</span>
                    {data.name}
                  </h3>
                  <p>设备类型：{data.type}</p>
                  <p>设备状态：{data.status}</p>
                  <p>所有人：{data.owner}</p>
                  <p>总貌图：{
                    data.overviewUrl ? <a onClick={() => this.showModal(data)}>查看</a> : '无'
                  }</p>
                </Card>
              })
            }
          </div>
        </div>
        {
          !footVisible
          ? <Icon type='up' className={footIconStyle} onClick={this.showFoot} />
          : false
        }
        <div className={footConStyle}>
          {
            !footVisible
            ? false
            : <Icon type='down' className={footIconStyle} onClick={this.hideFoot} />
          }
          <Row>
            <Col span='8'>
              <div className={styles['footCon']}>
                <div className={styles['lengent']}>
                  {
                    lengent.map((d, i) => {
                      return <p key={i} style={{ fontSize: 6, height: 14 }}>
                        <span style={{ color: d.color, marginRight: 5, fontSize: 18 }}>●</span>{d.label}
                      </p>
                    })
                  }
                </div>
                {
                  showTcs
                  ? false
                  : <Select
                    className={styles['selectYear']}
                    value={this.state.eventYear}
                    style={{ width: 60 }}
                    onChange={this.changeEventYear}
                    >
                    <Option value='2018'>2018</Option>
                    <Option value='2017'>2017</Option>
                    <Option value='2016'>2016</Option>
                    <Option value='2015'>2015</Option>
                  </Select>
                }
                <Spin spinning={this.state.tcsO2Loading} className={styles['footSpin']} />
                {
                  showTcs
                  ? <LineDarkStock title='氧的提取率' chartData={this.state.tcsO2Data} />
                  : <ColumnDark title='事件统计（次）' xData={this.state.xData} chartData={this.state.chartData} />
                }
              </div>
            </Col>
            <Col span='8'>
              <div className={styles['footCon']}>
                <Select
                  className={styles['selectYear']}
                  value={this.state.susbYear}
                  style={{ width: 60 }}
                  onChange={this.changeSusbYear}
                  >
                  <Option value='2018'>2018</Option>
                  <Option value='2017'>2017</Option>
                  <Option value='2016'>2016</Option>
                  <Option value='2015'>2015</Option>
                </Select>
                <LineDark title='开机时长（天）' xData={xData1} chartData={chartData1} />
              </div>
            </Col>
            <Col span='8'>
              <div className={styles['footCon']}>
                <LineDark title='故障分布（次）' xData={faultXData} chartData={faultChartData} />
              </div>
            </Col>
          </Row>
        </div>
        <div ref='GifInfoCon' />
      </div>
    )
  }
}
const mapStatesToProps = (state) => {
  return {}
}
export default connect(mapStatesToProps, { saveGroupId, saveDeviceData })(DeviceCard)
